package com.me;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * @author shichenguang
 * @desciption 描述
 * @date 2020-04-28 08:58
 */
public class Question2_11 {
    public static void main(String[] args) {
        /**
         * 数字颠倒/字符串反转
         * @author shichenguang
         * @date 2020/4/28 9:05

        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        getReverseString(s);
         */

        /**
         * @description 句子逆序
         * @author shichenguang
         * @date 2020/4/28 9:29

        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        getReverStirng(s);
         */
    }



    /**
     * @description 句子逆序
     * @author shichenguang
     * @date 2020/4/28 9:29
     */
    private static void getReverStirng(String s) {
        StringBuilder sb = new StringBuilder(s);
        StringBuilder reverse = sb.reverse();
        String[] outString  = reverse.toString().split(" ");
        StringBuilder outSb = new StringBuilder();
        for (int i = 0; i <outString.length; i++) {
            outSb.append(outString[i]);
            if(i != outString.length){
                outSb.append(" ");
            }
        }
        System.out.println(outSb);
    }


    /**
     * @description 11.数字颠倒/字符串反转
     * @author shichenguang
     * @date 2020/4/28 9:04
     */
    private static void getReverseString(String s){
        StringBuilder sb = new StringBuilder(s);
        StringBuilder reverse = sb.reverse();
        System.out.println(reverse);
    }
}
